//
//  MyWalletViewController.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/5.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MyWalletViewController.h"
#import "MyWalletViewModel.h"
#import "WithDrawalViewController.h"
#import "BankCardsViewController.h"
#import "BankCardListViewController.h"
#import "WithDrawlRecordViewController.h"
#import "PaymentDetailsViewController.h"
#import "CommissionSubsidiaryViewController.h"

@interface MyWalletViewController ()

@property (nonatomic, strong) MyWalletViewModel *viewModel;

@end

@implementation MyWalletViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = YES;
    self.viewModel = [[MyWalletViewModel alloc] initWithSuperView:self.view];
    kWeakSelf(self);
    self.viewModel.BlockLeftBtn = ^(GLGWButton * _Nullable leftbtn) {
        [weakself leftAction:leftbtn];
    };
    self.viewModel.BlockBtn = ^(GLGWButton * _Nullable btn) {
        [weakself btnAction:btn];
    };
    
}

- (void)leftAction:(GLGWButton *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)btnAction:(GLGWButton *)sender
{
    switch (sender.tag) {
        case 460: // 余额提现
            [self pageWithDraw:WithDrawType_Balance];
            break;
        case 461: // 佣金提现
            [self pageWithDraw:WithDrawType_Commission];
            break;
        case 462: // 提现记录
            [self pageWith:[WithDrawlRecordViewController class]];
            break;
        case 463: // 我的银行卡
            [self pageWith:[BankCardListViewController class]];
            break;
        case 464: // 佣金明细
            [self pageWith:[CommissionSubsidiaryViewController class]];
            break;
        case 465:// 收支明细
            [self pageWith:[PaymentDetailsViewController class]];
            break;
        default:
            break;
    }
}

- (void)pageWithDraw:(WithDrawType)type
{
    WithDrawalViewController *vc = [[WithDrawalViewController alloc] init];
    vc.withDrawType = type;
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)pageWith:(Class)cla
{
    UIViewController * vc = [[cla alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}



@end
